//
//  PopSecondTableViewCell.m
//  HAODE
//
//  Created by LiYinDi on 16/5/26.
//  Copyright © 2016年 reabam.com. All rights reserved.
//

#import "FilterSecondTableViewCell.h"

@implementation FilterSecondTableViewCell

- (void)awakeFromNib {
    
//
    [_itemNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15);
        make.height.equalTo(@21);
        make.centerY.equalTo(self.mas_centerY);
        make.width.equalTo(@200);
    }];
    [_selectedImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-20);
        make.height.equalTo(@18);
        make.centerY.equalTo(self.mas_centerY);
        make.width.equalTo(@18);
    }];
    [_lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left) ;
        make.height.equalTo(@1) ;
        make.bottom.equalTo(self.mas_bottom).with.offset(-1);
        make.right.equalTo(self.mas_right);
    }];
    [_customTimeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self) ;
       
    }];
    [_timeTagLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_customTimeView.mas_left).with.offset(15) ;
        make.height.equalTo(@21) ;
        make.centerY.equalTo(_customTimeView.mas_centerY);
        make.width.equalTo(@47);
    }];
    [_startTimeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_timeTagLabel.mas_right) ;
        make.height.equalTo(@44) ;
        make.centerY.equalTo(_customTimeView.mas_centerY);
        make.width.equalTo(@95);
    }];
    [_midLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_startTimeTextField.mas_right) ;
        make.height.equalTo(@21) ;
        make.centerY.equalTo(_customTimeView.mas_centerY);
        make.width.equalTo(@19);
    }];
    [_endTimeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_midLabel.mas_right) ;
        make.height.equalTo(@44) ;
        make.centerY.equalTo(_customTimeView.mas_centerY);
        make.width.equalTo(@95);
    }];
    [_timeConfirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_endTimeTextField.mas_right).with.offset(5) ;
        make.height.equalTo(@21) ;
        make.centerY.equalTo(_customTimeView.mas_centerY);
        make.right.equalTo(self.mas_right);
    }];

}
- (IBAction)timeConfirmBtnClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(timeConfirmButtonClick:)]) {
        [self.delegate timeConfirmButtonClick:sender.tag];
    }

}
-(void)setModel:(FilterSecondLevelModel *)model
{
    _itemNameLabel.text=model.itemName;
//    _itemNameLabel.hidden=NO;
//    _customTimeView.hidden=YES;
    if ([model.isCustom isEqualToString:@"Y"]) {
       
        _customTimeView.hidden=NO;
        _itemNameLabel.hidden=YES;
    }
    else
    {
        _customTimeView.hidden=YES;
        _itemNameLabel.hidden=NO;

    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
